-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I7 parameters #14
I7 parameters #14
Conversation
I just added some commits to get the test and demo working. Could you guys try running them and let me know if there are any problems? Currently, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytest
and demo-run are all successful except for test_wps_caps
. Nice work!
import os | ||
import logging | ||
import json | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use wps_tools
utils and io like you did in wps_parameters
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna save that for a different PR since Nik already assigned me a separate issue for that.
osprey/processes/wps_parameters.py
Outdated
if request.inputs["version"][0].data: | ||
from rvic import version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import statement in wps_convolution
is placed at the top. Should we be matching the place it is imported?
process_step="process", | ||
log_level=loglevel, | ||
) | ||
parameters(config, np) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While is good for now to pass config filepath right into RVIC parameters
, I think it would be nice to implement a pathway for calling the function with a dictionary argument depending on the RVIC version. We could probably do this later in another PR. I will leave that decision up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add this once your config_builder PR is done.
@@ -11,5 +10,5 @@ def test_wps_caps(): | |||
"/wps:Capabilities" "/wps:ProcessOfferings" "/wps:Process" "/ows:Identifier" | |||
) | |||
assert sorted(names.split()) == [ | |||
"hello", | |||
"convolution", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add parameters
here
#-- Path to Pour Points File (char) --# | ||
# A comma separated file of outlets to route to [lons, lats] - one coordinate pair per line (order not important) | ||
# May optionally include a column [names] - which will (if not aggregating) be included in param file | ||
FILE_NAME: tests/data/samples/sample_pour.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike RVIC convolution
that uses a huge dataset, I think it is pretty reasonable to test RVIC parameters
on local files. Good choice!
tests/test_wps_parameters.py
Outdated
from osprey.processes.wps_parameters import Parameters | ||
|
||
|
||
@pytest.mark.parametrize(("config"), [resource_filename(__name__, "data/samples/sample_parameter_config.cfg")]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to include a test case for opendap as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like, file paths inside the config file are opendap? I think I can make that work, but I'd have to delete a statement from rvic/parameters.py
which I'm not sure is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate more about deleting a statement in rvic/parameters.py
? Which line are you referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, unlike in rvic/convolution.py
, rvic/parameters.py
calls copy_inputs to copy the inputs to the CASEDIR
. In doing so, it calls the copyfile function for each file path in the config file. Since the opendap urls don't exists as local files, this won't work. If I get rid of the initial call to copy_inputs
, this won't be a problem, but I'd be removing functionality. The thing is, since this isn't done in rvic/convolution.py
, I don't know how necessary this statement is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that is very interesting. So none of POUR_POINTS, UH_BOX, ROUTING, and DOMAIN
supports opendap input? I think at least DOMAIN has to be taken from the server for proper use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my experience, only POUR_POINTS should be taken from user's local directory. @corviday What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small changes but I think this pretty much ready to go. I would wait to hear from @corviday before merging though.
- name: Test with pytest (full) | ||
if: github.ref == 'refs/heads/master' | ||
run: | | ||
py.test -v | ||
- name: Test with pytest (fast) | ||
if: github.ref != 'refs/heads/master' | ||
run: | | ||
py.test -m "not slow" -v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd much rather these were just commented out rather than removed.
osprey/processes/wps_parameters.py
Outdated
if request.inputs["version"][0].data: | ||
from rvic import version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point @sum1lim, it would be nice to have the files matching. I believe having the imports at the top is standard so we can move them there.
Could you guys try running |
Running
running it from the
|
I didn't know about the second set of modifications. After I made those, |
@corviday Is the PR ready for merging? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played around with the notebook, changing the pour point and looking at the results. The results seem good to me.
This PR solves issue 7, which is to wrap the
parameters
module into a process, test it withpytest
, and show it in ademo
notebook. The only things that need to be done are to properly incorporatewps_tools
(currently in progress) and test it usingopendap
files.